Returns the year from a serial date number that is generated by the DateSerial or the DateValue function.
DateSerial ないし DateValue 関数による日付データのシリアル変換値を基に、該当する年を返します。
Year (Number)
Year (Number)
Integer
整数
Number: Integer expression that contains the serial date number that is used to calculate the year.
Number: 年情報を得る日付データのシリアル変換値を示す数値表式。
This function is the opposite of the DateSerial function, and returns the year of a serial date. For example, the expression:
この関数は DateSerial 関数と逆方向の機能を担っており、日付データのシリアル変換値から該当する年を取得します。こうした点は、下記のコードを実行してみると分かりやすいでしょう。
Print Year(DateSerial(1994, 12, 20))
Print Year(DateSerial(1994, 12, 20))
returns the value 1994.
この場合の戻り値は 1994 となります。
Sub ExampleYear
Sub ExampleYear
MsgBox "" & Year(Now) ,64,"Current year"
MsgBox "" & Year(Now) ,64,"Current year"
End sub
End sub